package com.kede.api.file.config;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.time.ZoneOffset;

/***
 ** @Author:Pr.li
 ** @Description:
 ** @Date: create in 2023/5/5 16:13
 ***/
@Component
public class DateUpdateConfig implements MetaObjectHandler {
    @Override
    public void insertFill(MetaObject metaObject) {
        LocalDateTime now = LocalDateTime.now();
        this.setFieldValByName("create_time",now,metaObject);
        this.setFieldValByName("update_time",now,metaObject);
    }

    @Override
    public void updateFill(MetaObject metaObject) {
        LocalDateTime now = LocalDateTime.now();
        this.setFieldValByName("update_time",now,metaObject);
    }
}
